/*
 *  IRQ.c
 *  xD-OS
 *
 *  Created by James Johns on 03/08/2009.
 *  Copyright 2009 xD-Dunce. All rights reserved.
 *
 */

#include "global.h"
#include "IDT.h"
#include "IRQ.h"


void initIRQ(){
	outB(0x20, 0x11);
	outB(0xA0, 0x11);
	outB(0x21, 0x20);
	outB(0xA1, 0x28);
	outB(0x21, 0x04);
	outB(0xA1, 0x02);
	outB(0x21, 0x01);
	outB(0xA1, 0x01);
	outB(0x21, 0x0);
	outB(0xA1, 0x0);
	
	addIDTEntry(32, (dWord)irq0, 0x08, 0x8E);
	addIDTEntry(33, (dWord)irq1, 0x08, 0x8E);
	addIDTEntry(34, (dWord)irq2, 0x08, 0x8E);
	addIDTEntry(35, (dWord)irq3, 0x08, 0x8E);
	addIDTEntry(36, (dWord)irq4, 0x08, 0x8E);
	addIDTEntry(37, (dWord)irq5, 0x08, 0x8E);
	addIDTEntry(38, (dWord)irq6, 0x08, 0x8E);
	addIDTEntry(39, (dWord)irq7, 0x08, 0x8E);
	addIDTEntry(40, (dWord)irq8, 0x08, 0x8E);
	addIDTEntry(41, (dWord)irq9, 0x08, 0x8E);
	addIDTEntry(42, (dWord)irq10, 0x08, 0x8E);
	addIDTEntry(43, (dWord)irq11, 0x08, 0x8E);
	addIDTEntry(44, (dWord)irq12, 0x08, 0x8E);
	addIDTEntry(45, (dWord)irq13, 0x08, 0x8E);
	addIDTEntry(46, (dWord)irq14, 0x08, 0x8E);
	addIDTEntry(47, (dWord)irq15, 0x08, 0x8E);
}


